#pragma once

#include <concrt.h>

class CReaderWriterLockerPPL
{
private:
	Concurrency::reader_writer_lock rwLock;
public:
	void lock_write() { this->rwLock.lock(); }
	void lock_read() { this->rwLock.lock_read(); }
	void unlock_write(){ this->rwLock.unlock(); }
	void unlock_read(){ this->rwLock.unlock(); }
};

class CReaderWriterLockerSRW
{
private:
	SRWLOCK lock;
public:
	CReaderWriterLockerSRW()
	{
		InitializeSRWLock(&this->lock);
	}

	void lock_write() { AcquireSRWLockExclusive(&this->lock); }
	void lock_read() { AcquireSRWLockShared(&this->lock); }
	void unlock_write(){ ReleaseSRWLockExclusive(&this->lock); }
	void unlock_read(){ ReleaseSRWLockShared(&this->lock); }
};
